package level.editor.tool.layer;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

import level.editor.command.Command;
import level.editor.tool.Tool;
import level.editor.tool.ToolCommand;
import level.editor.tool.ToolView;

public class ToolLayer extends JPanel implements Tool, ActionListener
{
	private ToolView view;
	private Visibility vis;
	private Lock lock;

	public ToolLayer(ToolView view)
	{
		super();
		setPreferredSize(new Dimension(400, 400));
		this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
		this.view = view;
		init();
	}
	
	private void init()
	{
		vis = new Visibility();
		lock = new Lock();
		JLabel label = new JLabel("Layer Name                                                                      ");
		label.setAlignmentX(Component.CENTER_ALIGNMENT);
		add(label);
		add(new ToolLayerBlock("First", 1));
		add(new ToolLayerBlock("Second", -1));
	}
	
	public Visibility getVisibility()
	{
		return vis;
	}

	public Lock getLock()
	{
		return lock;
	}
	
	@Override
	public void actionPerformed(ActionEvent e)
	{
		
	}

	@Override
	public void pushUpCommand(Command command)
	{
		view.pushUpCommand(command);
	}

	@Override
	public void pushDownCommand(Command command)
	{
		((ToolCommand) command).execute(this);
	}

	@Override
	public void handleClick(MouseEvent e)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void handlePress(MouseEvent e)
	{
		// TODO Auto-generated method stub
		
	}

}
